using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using CodeSaude.Domain.Entities;

namespace CodeSaude.Infrastructure.Data.EntityConfig
{
    public class MedicamentoMap : EntityTypeConfiguration<Medicamento>
    {
        public MedicamentoMap()
        {
            // Primary Key
            HasKey(t => t.MedicamentoId);

            // Properties
            Property(t => t.MedicamentoId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            Property(t => t.NomeMedicamento)
                .IsRequired()
                .HasMaxLength(255);

            // Table & Column Mappings
            ToTable("Medicamento");
            Property(t => t.MedicamentoId).HasColumnName("id_medicamento");
            Property(t => t.NomeMedicamento).HasColumnName("nome_medicamento");
            Property(t => t.IdSituacao).HasColumnName("id_situacao");
        }
    }
}
